

local _M = {}

-- write to ./bin.dat
function _M.writeFile(binData)
  if not binData then
    print("nil binData")
    return
  end

  local f = assert(io.open("./bin.dat", "wb"))
  f:write(binData)
end

-- toString
function printObj(obj)
  if type(obj) == 'table' then
    for k,v in pairs(obj) do
      return ('k='.. k .. ',v=' .. printObj(v))
    end
  else
    return ''..obj
  end
end

function _M.printTbl(tbl)
  for k,v in pairs(tbl) do
    local tmpV
    if type(v) == 'table' then 
      tmpV = 'table' 
    else
      tmpV = ''..v
    end
    print ('k='.. k .. ',v=' .. tmpV)
  end
end


_M.printObj = printObj

return _M

